<?php

	class fluxView extends fluxUri {

		protected $View         = NULL;
		protected $ViewsPath    = NULL;
		private   $viewVar      = '_fxview';

		public function setVar ($var,$value=NULL) {

				  $this->$var = $value;

		}

		public function setView () {

		}

		public function getViewsPath () {
	
			return ($this -> ViewsPath);

		}


		public function loadView ($view=NULL) {

			if ($this->override)
					  return FALSE;

			if ($this->hasErrorHandler)
					  return FALSE;

			if (!$view)
				$view = $this -> ViewsPath . _DS . $this -> Controller . _DS . $this -> Action . '.phtml';

			//We could use this .. or whatever instead of _fxview 

			fluxLoader::load($view,$this->viewVar,$this->getViewInstance());

		}

		public function  setViewVariable ($var=NULL) {
				  if (is_null ($var)||empty ($var))
							 throw (new fluxXception('View variable cannot be null or empty you should use something like "this" or "_view" or whatever you like'));

			$this->viewVar = $var;

		}

		public function getViewVariable () {
				  return $this->viewVar;
		}

		public function getViewInstance () {
				  return $this;
		}

		public function getViewFile ($view) {

			//return ('application' . _DS . 'views' . _DS . $view . 

		}

		public function setViewsPath ($path=NULL) {

			if (!is_null ($this -> ViewsPath) || !empty ($this -> ViewsPath))
				return ($this -> ViewsPath);

			if (is_null ($path) || empty ($path))
				return ($this -> ViewsPath = 'application' . _DS . 'views');

			return ($this -> ViewsPath = $path);

		}


	}

?>
